<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>客户信息管理</title>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery/jquery.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery/jquery-ui/jquery-ui.js"></script>

<script src="${pageContext.request.contextPath}/js/bootstrap/bootstrap.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/ui/table/bootstrap-table.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/ui/table/locale/bootstrap-table-zh-CN.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/ui/table/plugins/tableExport.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/ui/table/plugins/table-export.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/ui/table/plugins/jquery.base64.js" type="text/javascript"></script>

<script src="${pageContext.request.contextPath}/ui/layui/layui.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/ui/layui/lay/modules/laydate.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/ui/layui/lay/modules/layer.js" type="text/javascript"></script>
 <script src="${pageContext.request.contextPath}/ui/layui/lay/modules/form.js" type="text/javascript"></script>
 <link rel="stylesheet" href="${pageContext.request.contextPath}/ui/layui/css/modules/laydate/laydate.css" >
 <link rel="stylesheet" href="${pageContext.request.contextPath}/css/jquery-css/jquery-ui.css">
 <link rel="stylesheet" href="${pageContext.request.contextPath}/css/bootstrap-css/bootstrap.css">
<link rel="stylesheet" href="${pageContext.request.contextPath}/ui/table/bootstrap-table.css">
<link rel="stylesheet" href="${pageContext.request.contextPath}/ui/layui/css/layui.css" >
<link rel="stylesheet" href="${pageContext.request.contextPath}/ui/layui/css/global.css" >
<link rel="stylesheet" href="${pageContext.request.contextPath}/ui/layui/css/modules/layer/default/layer.css" >
 <link rel="stylesheet" href="${pageContext.request.contextPath}/ui/layui/css/modules/code.css" >


 <style>
  .container{
   	width:85%;
   	
  }
  
  .modal-industry{
  	width:900px;
  }
  .modal-body{
    max-height:750px;
  }
   .modal-body-industry{
  	height:450px;
  }
    
 </style>

</head>
<body>
<%@include file="/webpage/frame/top.jsp" %>
<div class="container">	
	<div id="modal" class="modal-industry modal fade" style="display:none">
		<div class="modal-dialog">
			<div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title"></h4>
                    <span class='alert_input'></span>
                </div>
                <div class="modal-body-industry modal-body">
                    <div class="form-group">
                        <label>网站域名</label>
                        <!-- <input type="text" class="form-control" name="domain" placeholder="网站域名"> -->
                        <textarea placeholder="网站域名" class="layui-textarea" name="domain" readonly="readonly"></textarea>
                    </div>
                                    
	               <table id="contractInfoable"  data-show-refresh="true"           
			               data-search="true"
			               data-click-to-select="true"
						   data-pagination="true"		
						   data-toolbar=".account-toolbar"
						   data-query-params="queryParams"  
				   			>
                		 <thead>
                		   <tr>                			
            				<th data-field="id" data-show="true" data-visible="false">ID</th> 
               			    <th data-field="signDate">签约时间</th>
                			<th data-field="expireDate">合约到期时间</th>
                			<th data-field="serviceCycle">服务周期</th>
                			<th data-field="servicePrice">服务费用</th>
                			<th data-field="adOnlineDate">广告上线时间</th>
                			<th data-field="adOfflineDate">广告到期时间</th>
                			<th data-field="channeName">推广平台</th>
                			<th data-field="hitAvgPrice">CPC</th>
                			
                			<th data-field="loginName">推广账号</th>
                			<!-- <th data-field="loginPassword">密码</th> -->
                			<th data-field="bindPhone">绑定手机</th>
                			<th data-field="budgetDay">日预算</th>
                			
<!--                 			<th data-field="action"
                    				data-align="center"
                   					 data-formatter="accountActionFormatter"
                   					 data-events="actionEvents">操作</th>
            			  </tr> -->
                       </thead>
	               </table>              		              		             		                	              	                			
				</div>			
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                </div>				
			</div>
		</div>	
	</div>

	
	<table id="companytable"  data-show-refresh="true"
              data-search="true"
              data-click-to-select="true"
              data-show-export="true"
              data-query-params="queryParams"             
              data-pagination="true"
		   	  data-toolbar=".toolbar"		   
              >
             <!-- data-show-columns="true"  -->          
           <thead>
           <tr>
           	<th data-field="id" data-show="true" data-visible="false">id</th>
            <th data-field="industryName">所属行业</th>
            <th data-field="domain" data-visible="false">网站域名</th>
            <th data-field="companyName">公司名称</th>
            <th data-field="customerName">客户姓名</th>
            <th data-field="mobile">客户联系电话</th>
            <th data-field="payStatus">续费状态</th>
            <th data-field="salesDepartment">销售部门</th>
            <th data-field="isInstalledBridge">是否安装代码</th>
            <th data-field="ifGiveWap">是否赠送wap站</th>
            <th data-field="siteCompany">维护公司名称</th>
            <th data-field="scPhone">维护公司联系电话</th>
            <th data-field="scQq">维护公司联系qq</th>         
                     
            <th data-field="action"
                data-align="center"
                data-formatter="actionFormatter"
                data-events="actionEvents">操作</th>
           </tr>
           </thead>
		
	</table>

</div>

<script type="text/javascript">
	//初始化，加载公司信息列表
	var API_URL = '${pageContext.request.contextPath}/businessSupportController.do?getAllCompanyMsg';	
	var $table = $('#companytable').bootstrapTable(
			{
				url: API_URL,
				pageSize:25,
				pageList : [15, 25, 100, 500],
			}),     
	   $modal = $('#modal').modal({show: false}),
	   $alert = $('.alert').hide(),
	   $alert_input = $('.alert_input').hide();
	
    function actionFormatter(value,row, index) {        
    	buttonArray =  new Array();
    	buttonArray[0]='<a class="update btn btn-default" href="javascript:" title="查看详细">查看详细</a>';   	
        return buttonArray.join(' ');
    }

    window.actionEvents = {
            'click .update': function (e, value, row) {
            	showModal_update($(this).attr('title'), row);
            }    
    }

    //弹出窗口-查看
    function showModal_update(title, row) { 
    	console.log("行id--"+row.id);

        $modal.data('id', row.id);
        $modal.find('.modal-title').text(title);
        
        for (var name in row) {
            $modal.find('input[name="' + name + '"]').val(row[name]);
            $modal.find('textarea[name="' + name + '"]').val(row[name]);
        }   
        
    	//初始化，对应合同信息列表 
    	var URL = '${pageContext.request.contextPath}/businessSupportController.do?getContractInfoByUserId';	
    	var $conTable = $('#contractInfoable').bootstrapTable(
    			{
    				url: URL,
    				pageSize:25,
    				pageList : [15, 25, 100, 500],
    				queryParams:{userId:row.id}
    			});           	   	
		//刷新服务器数据
		$('#contractInfoable').bootstrapTable('refresh', {query: {userId:row.id}});	
		
    	$modal.modal('show');
    }
    
    
</script>


<%@include file="/webpage/frame/bottom.jsp" %>
</body>
</html>